use crate::error::ModuleError;
use common::util::run_command;
use std::path::PathBuf;

pub async fn async_launch_project(project_dir: PathBuf) -> Result<(), ModuleError> {
    run_command(project_dir.as_path(), "npm", &["i"])
        .map_err(|err| ModuleError::Cmd(format!("{}", err)))?;
    run_command(project_dir.as_path(), "npm", &["run", "dev"])
        .map_err(|err| ModuleError::Cmd(format!("{}", err)))?;
    Ok(())
}
